package com.club325.voicemicroblog.persist.test;

import com.club325.voicemicroblog.database.hibernateutil.HibernateUtil;
import com.club325.voicemicroblog.domain.PrivateInfo;

public class PrivateInfoEnvironment implements Environment {
	protected static final String PrivateNewUserID = UserEnvironment.TestNewUserID;
	
	protected static final String PrivateUserID = UserEnvironment.TestUserID1;
	protected static final String PrivateUserID1 = UserEnvironment.TestUserID2;
	protected static final String PrivateUserID2 = UserEnvironment.TestUserID3;
	protected static final String Address1 = "TestAddress1";
	protected static final String Address2 = "TestAddress2";
	protected static final int QQ1 = 123456789;
	protected static final int QQ2 = 987654321;
	
	private String UserID = null;
	protected PrivateInfo pi, pi1, pi2, npi;

	public PrivateInfoEnvironment() {
		UserID = PrivateUserID;
		
		pi = new PrivateInfo();
		pi1 = new PrivateInfo();
		pi2 = new PrivateInfo();
		npi = new PrivateInfo();
		
		pi.setUserID(UserID);
		pi1.setUserID(PrivateUserID1);
		pi2.setUserID(PrivateUserID2);
		npi.setUserID(PrivateNewUserID);
		pi1.setAddress(Address1);
		pi2.setAddress(Address2);
		pi1.setQQ(QQ1);
		pi2.setQQ(QQ2);
	}
	
	public PrivateInfoEnvironment(String userID)
	{
		UserID = userID;
	}

	public void setup() {
		HibernateUtil.add(pi);
		HibernateUtil.add(pi1);
		HibernateUtil.add(pi2);
	}

	public void tearDown() {
		HibernateUtil.delete(pi);
		HibernateUtil.delete(pi1);
		HibernateUtil.delete(pi2);
	}

}
